#include "vtkFieldImport_boundary.hpp"

namespace hms::vtk
{

std::string availableBoundaryTypes(){
	using T = boundaryCondition::Type;

	std::vector<std::string_view> bcNames;

	auto untilUnderscore = [&]( std::string_view bcName ){
		/* string_view::find returns npos when not successful, 
		 * and substr(0, npos) returns the whole string */
		std::size_t len { bcName.find('_') };
		return bcName.substr(0, len);
	};

	for ( int i{0}; i < static_cast<int>(T::nTypes); ++i ){
		std::string_view bcName { untilUnderscore(
			magic_enum::enum_name( static_cast<T>(i) )
		) };

		if ( i>0 && bcNames.back() == bcName )
			continue;
		
		bcNames.push_back( bcName );
	}

	std::string availableTypes;

	for ( const auto& bcName : bcNames ){
		availableTypes += "\n\t"s + std::string{bcName};
	}

	return availableTypes;
}

} // namespace hms::vtk
